var baseLink = "http://www.applelew.com";
Store = {
  
  innerValue : '',
  
  
  
  getValue: function(key) {
    Store.store.get(key, function(ok, val) {
      if (ok)
        Store.innerValue = val;
      else
      	Store.innerValue = '';
    });
  },
  
  get : function(key){
  	Store.getValue(key);
  	return Store.innerValue;
  },
  

  set: function(key,val) {
    Store.store.set(key, val);
  },
  
  remove:function(key){
  	Store.store.remove(key, function(ok, val) {
      // prompt user
      alert('some_key was removed');
    });
  },


  init: function() {
    // create new persistent store
    Store.store = new Persist.Store('applelew', {
      swf_path: '../persist.swf'
    });
  }
};

function baseLnk(){
	window.location = baseLink;
}

// 去链接虚线 FOR IE
function $j(id){
	return document.getElementById(id);
}

function bluring(){
if(event.srcElement.tagName=="A"||event.srcElement.tagName=="IMG") document.body.focus();
}
document.onfocusin=bluring;

// 品牌链接 
function changeBrand(url){

	//todo change img or css 
	//var content = $j('content');
	//content.src = url;
	window.parent.location = url;
}
var offImgsrcPrefix = "resource/images/common/BarTab_brand";
var offImgsrcSurfix = "_off.png";
var ovrImgsrcPrefix = "resource/images/common/BarTab_brand";
var ovrImgsrcSurfix = "_on.png";
function offImg(index){
	document.getElementById("barLnk_" + index).src = offImgsrcPrefix + index + offImgsrcSurfix;
}

function ovrImg(index){
	document.getElementById("barLnk_" + index).src = ovrImgsrcPrefix + index + ovrImgsrcSurfix;
}

// 页面导航 

function showSubNav(obj){
	//alert(obj);
	$j(obj+"Children").style.display = 'block';
	$j(obj).className = "topnavSprite_" + obj + "_over";
}

function hideSubNav(obj){
	$j(obj+"Children").style.display = 'none';
	$j(obj).className = "topnavSprite_" + obj + "_off";
}

function showSubDivision(obj){
	$j(obj).className = "topnavSprite_" + obj + "_over";
}

function hideSubDivision(obj){
	$j(obj).className = "topnavSprite_" + obj + "_off";
}

//打开窗口
function M_openWindow( url,winName,width,height)   
{  
xposition=0; yposition=0;  
if ((parseInt(navigator.appVersion) >= 4 ))  
{  
xposition = 0;  
yposition = 0;  
}  
theproperty= "width=" + width + ","   
+ "height=" + height + ","   
+ "location=0,"   
+ "menubar=0,"  
+ "resizable=0,"  
+ "scrollbars=1,"  
+ "status=1,"
+ "titlebar=0,"  
+ "toolbar=0,"  
+ "hotkeys=0," 
+ "screenx=" + xposition + "," //仅适用于Netscape  
+ "screeny=" + yposition + "," //仅适用于Netscape  
+ "left=" + xposition + "," //IE  
+ "top=" + yposition; //IE   
window.open( url,winName,theproperty);  
}

function wndopen(url)
{
	//alert(url);
	M_openWindow(url,"viewImages","720","655");
	/*
	var i = index;
	
	switch(i)
	{
		case 1:
		M_openWindow("viewImages.htm","viewImages","720","655");
		break;

		default:	
		break;
	}
	*/
}

//Switch Tab Effect 滑动门JS
var Goaler={
    init:function(){
        var elms = document.getElementsByName("sliding");
        for(var g=0; g<elms.length; g++){
            var lielms = elms[g].getElementsByTagName('LI');
            for(var i=0; i<lielms.length; i++){
                lielms[i].onmousedown = function(){
                    var pnobj = this.parentNode.parentNode.nextSibling.tagName == "DIV" ? this.parentNode.parentNode.nextSibling : this.parentNode.parentNode.nextSibling.nextSibling;
                    var objsx = pnobj.getElementsByTagName('UL');
                    var elmsx = this.parentNode.getElementsByTagName('LI');
                    var thisx = 0;
                    
                    for(var j=0; j<elmsx.length; j++){
                        if(elmsx[j] == this) thisx = j;
                        elmsx[j].className="";
                        objsx[j].style.display="none";
                    }
                    
                    this.className='on';
                    objsx[thisx].style.display="";
                }
            }
        }
    }
}